<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>

<%@ page import="com.easyui.common.UserLogin" %>

<%
	String userID = (String)session.getAttribute("userID");
	String role = (String)session.getAttribute("role");

	String pno = request.getParameter("pno");
	String pname = new String(request.getParameter("pname").getBytes("ISO-8859-1"), "utf-8");
	
%>


<script>
	var pDPropertyGrid;
	$(function(){
		console.info(<%= pno %>);
		console.info('<%= pname %>');
		pDPropertyGrid = $('#pDPropertyGrid').propertygrid({
			url: 'servlet/ProjectDetailServlet?pno=' + <%= pno %> ,
			method: 'post',
			showGroup: true,
			scrollbarSize: 0,
			nowrap:false,
			fitColumns:true,
			showHeader:false,
			border:false,
			columns: [[{
				field:'name',
				width:50,
				align:'left'
			},{
				field:'value',
				width:150,
				formatter: function(value,rowData,rowIndex){
					if(rowData.name == '附件') {
						var v = value.split(",");
					 	return '<a href="servlet/DownloadServlet?ano=' + v[0] + '" >' + v[1] +'</a>';
					} else {
						return value;
					}
		     	}
			}]]
		});
		
	});

	modify = function() {
		$('#projectDetailDialog').dialog('close');
		var title = "修改项目_<%= pname %>";
		modifyProjectDialog = $('#modifyProjectDialog').dialog({
			title:title,
			modal:true,
			collapsible:false,
			showHeader:false,
			width:700,
			height:550,
			href:'teacher/modifyProject.jsp?pno=' + <%= pno %>
		});
		
		modifyProjectDialog.dialog('open');
	}
</script>

<div >
	<table id="pDPropertyGrid"></table>
</div>

<% 
	if(userID != null && role != null && !userID.trim().equals("") && !role.trim().equals("")) {
		if(role.equals("teacher")) {
%>
<div style="float:right">
	<a href="javascript:void(0);" class="easyui-linkbutton"  pain="false" onclick="modify();">修改</a>
</div>

<% 
		}
	}
%>